]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
NetworkStatus: ignore invalid and unsupported connection types
authorGiovanni Campagna <gcampagna@src.gnome.org>
Sat, 26 Mar 2011 17:38:20 +0000 (18:38 +0100)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Sun, 3 Apr 2011 12:24:58 +0000 (14:24 +0200)
Some connection types (like wimax) are not supported by the menu, and
should be ignored instead of throwing exceptions. Also, NetworkManager
had a bug that sent connections with invalid settings. This should not
happen, but in case it does, we will not blow up, but just log a warning
and continue silently.

https://bugzilla.gnome.org/show_bug.cgi?id=646355

js/ui/status/network.js

index 1bb73e7d3c0165f9dd9caa9c6222b7872d5e307b..300c08dd2d62a448c3f744e58467761f9819bf2e 100644 (file)
@@ -22,6 +22,7 @@ const Gettext = imports.gettext.domain('gnome-shell');
 const _ = Gettext.gettext;
 
 const NMConnectionCategory = {
+    INVALID: 'invalid',
     WIRED: 'wired',
     WIRELESS: 'wireless',
     WWAN: 'wwan',
@@ -1928,11 +1929,12 @@ NMApplet.prototype = {
             this._connections.splice(connection);
 
         let section = connection._section;
+
         if (section == NMConnectionCategory.VPN) {
             this._devices.vpn.device.removeConnection(connection);
             if (this._devices.vpn.device.empty)
                 this._devices.vpn.section.actor.hide();
-        } else {
+        } else if (section != NMConnectionCategory.INVALID) {
             let devices = this._devices[section].devices;
             for (let i = 0; i < devices.length; i++)
                 devices[i].removeConnection(connection);
@@ -1946,16 +1948,19 @@ NMApplet.prototype = {
     _updateConnection: function(connection) {
         let connectionSettings = connection.get_setting_by_name(NetworkManager.SETTING_CONNECTION_SETTING_NAME);
         connection._type = connectionSettings.type;
-        connection._section = this._ctypes[connection._type];
+
+        connection._section = this._ctypes[connection._type] || NMConnectionCategory.INVALID;
         connection._name = connectionSettings.id;
         connection._uuid = connectionSettings.uuid;
         connection._timestamp = connectionSettings.timestamp;
 
         let section = connection._section;
+
+        if (connection._section == NMConnectionCategory.INVALID)
+            return;
         if (section == NMConnectionCategory.VPN) {
             this._devices.vpn.device.checkConnection(connection);
             this._devices.vpn.section.actor.show();
-            connection._everAdded = true;
         } else {
             let devices = this._devices[section].devices;
             for (let i = 0; i < devices.length; i++) {